/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package DAO;

import entity.Mesas;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

/**
 *
 * @author FRANCO
 * @author alberto
 */
@Stateless
public class MesasFacade extends AbstractFacade<Mesas> implements MesasFacadeRemote {
    @PersistenceContext(unitName = "socafe-ejbPU")
    private EntityManager em;

    @Override
    protected EntityManager getEntityManager() {
        return em;
    }

    public MesasFacade() {
        super(Mesas.class);
    }

    @Override
    public boolean crearMesa(int capacidad) {
        Mesas mesa = new Mesas(0);
        mesa.setCapacidad(capacidad);
        mesa.setEstatus(Boolean.FALSE);
        try{
            create(mesa);
            return true;
        }catch(Exception ex){ 
            return false;
        }        
        
    }
    
}
